package com.abigdreamer.im.server.cmd.commandAction;

import com.abigdreamer.im.server.cmd.command.Command;
import com.abigdreamer.im.server.cmd.resouse.CMDConfig;
import com.abigdreamer.im.server.cmd.resouse.ConfigFactory;
import com.abigdreamer.im.server.cmd.resouse.Mapping;

public class HelpAction extends CommandAction{

	protected String echo(Command command) {
		String result="";
		CMDConfig config=ConfigFactory.getInstance().getCMDConfig();
		if(0==command.getParam().size()){
			result=config.getCmdInfo();
		}else{
			String commandID=command.getParam().get(0);
			Mapping map=config.getMappByID(commandID);
			if(null==map){
				result="不存在命令\""+commandID+"\"";
			}else{
				result=map.getHelpDesc();
			}
		}
		return result;
	}

	
}
